package behavioral_pattern.observer_pattern;

/**
 * 观察者设计模式
 * 定义： 一个对象发生改变时将自动通知其他对象，其他对象将对应做出反应。
 */
public class MainObserver {
    public static void main(String[] args) {

        AllyControlCenter acc = new ConcreteAllyControlCenter("红花会");

        Observer observer1,observer2,observer3,observer4;
        observer1 = new Player("张君宝");

        observer2 = new Player("魏小宝");

        observer3 = new Player("张无忌");

        observer4 = new Player("张三丰");

        acc.join(observer1);
        acc.join(observer2);
        acc.join(observer3);
        acc.join(observer4);

        observer1.beAttacked(acc);

    }
}
